package com.leyou.item.config;


import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author:yanjizhw@163.com
 * @date:2019-09-29 14:06
 * 描述: 添加一些虚拟路径的映射, 静态资源路径和上传文件的路径
 * @since:1.0.0
 */
@Component
public class MvcConfig implements WebMvcConfigurer {


    /**
     * addResourceHandler, 创建一个虚拟路径/Path/** ，
     * 即只要在<img src="/Path/xxx.jpg" /> 便可以直接引用图片
     * addResourceLocations, 图片的物理路径 "file:/+本地图片的地址"
     * @param registry
     */
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/path/**").addResourceLocations("file:/D:/data/javadata/idea/yun6/image/");
        WebMvcConfigurer.super.addResourceHandlers(registry);
    }

}
